import Mock from 'mockjs'
import { doCustomTimes } from '@/libs/util'
const Random = Mock.Random

export const getMessageInit = () => {
  let unreadList = []
  doCustomTimes(3, () => {
    unreadList.push(Mock.mock({
      title: Random.cword(10, 15),
      create_time: '@date',
      msg_id: Random.increment(100)
    }))
  })
  let readedList = []
  doCustomTimes(4, () => {
    readedList.push(Mock.mock({
      title: Random.cword(10, 15),
      create_time: '@date',
      msg_id: Random.increment(100)
    }))
  })
  let trashList = []
  doCustomTimes(2, () => {
    trashList.push(Mock.mock({
      title: Random.cword(10, 15),
      create_time: '@date',
      msg_id: Random.increment(100)
    }))
  })
  return {
    unread: unreadList,
    readed: readedList,
    trash: trashList
  }
}

export const getContentByMsgId = () => {
  return `<divcourier new',="" monospace;font-weight:="" normal;font-size:="" 12px;line-height:="" 18px;white-space:="" pre;"=""><div>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: medium;">这是消息内容，这个内容是使用<span style="color: rgb(255, 255, 255); background-color: rgb(28, 72, 127);">富文本编辑器</span>编辑的，所以你可以看到一些<span style="text-decoration-line: underline; font-style: italic; color: rgb(194, 79, 74);">格式</span></span></div><ol><li>你可以查看Mock返回的数据格式，和api请求的接口，来确定你的后端接口的开发</li><li>使用你的真实接口后，前端页面基本不需要修改即可满足基本需求</li><li>快来试试吧</li></ol><p>${Random.csentence(100, 200)}</p></divcourier>`
}

export const hasRead = () => {
  return true
}

export const removeReaded = () => {
  return true
}

export const restoreTrash = () => {
  return true
}

export const messageCount = () => {
  return 3
}
//= ===
export const addUserMember = () => {
  return {
    'code': 200,
    'message': '创建成功',
    'data': null
  }
}

export const getMembereUser = () => {
  return {
    'code': 200,
    'message': '获取成功',
    'data': {
      'total': 100,
      'pageSize': 20,
      'list': [
        {
          'member_id': 1,
          'nickname': '陈小莫',
          'phone': '15659638071',
          'avator': 'https://pic.qqtn.com/up/2019-1/2019012709265098004.jpg',
          'email': 'cfz2600@qq.com',
          'create_time': '2019.02.18 16:29',
          'update_time': '2019.02.18 16:29',
          'create_ip': '127.0.0.1',
          'state': true
        }, {
          'member_id': 2,
          'nickname': '陈小莫2',
          'phone': '15659638071',
          'avator': 'https://pic.qqtn.com/up/2019-1/2019012709265098004.jpg',
          'email': 'cfz2600@qq.com',
          'create_time': '2019.02.18 16:29',
          'update_time': '2019.02.18 16:29',
          'create_ip': '127.0.0.1',
          'state': true
        }, {
          'member_id': 3,
          'nickname': '陈小莫3',
          'phone': '15659638071',
          'avator': 'https://pic.qqtn.com/up/2019-1/2019012709265098004.jpg',
          'email': 'cfz2600@qq.com',
          'create_time': '2019.02.18 16:29',
          'update_time': '2019.02.18 16:29',
          'create_ip': '127.0.0.1',
          'state': false
        }
      ]
    }
  }
}

export const setMembereState = () => {
  return {
    'code': 200,
    'message': '操作成功',
    'data': {
      'state': false
    }
  }
}

export const delMemberUser = () => {
  return {
    'code': 200,
    'message': '操作成功',
    'data': null
  }
}

export const editMemberUser = () => {
  return {
    'code': 200,
    'message': '编辑成功',
    'data': null
  }
}

export const getMemberInfo = () => {
  return {
    'code': 200,
    'messge': '获取成功',
    'data': {
      'member_id': 1,
      'nickname': '陈小莫',
      'phone': '15659638071',
      'avator': 'https://pic.qqtn.com/up/2019-1/2019012709265098004.jpg',
      'email': 'cfz2600@qq.com',
      'create_time': '2019.02.18 16:29',
      'update_time': '2019.02.18 16:29',
      'create_ip': '127.0.0.1',
      'state': false
    }
  }
}
